﻿// unbind.cpp: 实现文件
//

#include "pch.h"
#include "MFCdemo.h"
#include "unbind.h"
#include "afxdialogex.h"


// unbind 对话框

IMPLEMENT_DYNAMIC(unbind, CDialogEx)

unbind::unbind(CWnd* pParent /*=nullptr*/)
	: CDialogEx(IDD_DIALOG3, pParent)
{

}

unbind::~unbind()
{
}

void unbind::DoDataExchange(CDataExchange* pDX)
{
	CDialogEx::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_EDIT1, user);
	DDX_Control(pDX, IDC_EDIT2, pwd);
}


BEGIN_MESSAGE_MAP(unbind, CDialogEx)
	ON_BN_CLICKED(IDC_BUTTON1, &unbind::OnBnClickedButton1)
END_MESSAGE_MAP()


// unbind 消息处理程序


void unbind::OnBnClickedButton1()
{
	wchar_t User[100]{ 0 };
	user.GetWindowTextW(User, 100);

	wchar_t Pwd[100]{ 0 };
	pwd.GetWindowTextW(Pwd, 100);

	if (!sdk->UserUnBind(string_convert::UnicodeToANSI(User), string_convert::UnicodeToANSI(Pwd), "111111", "1"))
	{
		SHOW_MSG(sdk->error_msg.c_str());
		return;
	}
	SHOW_MSG(("扣除时间 :" + convert<std::string>(sdk->Deduct) + "分钟").c_str());
}
